﻿namespace Ids4.Api.Application.Common
{
    public class SelectItemData
    {
        public SelectItemData(string id, string text)
        {
            Id = id;
            Text = text;
        }

        public string Id { get; set; }

        public string Text { get; set; }

        public static List<SelectItemData> ToSelectList<T>() where T : struct, IComparable
        {
            var selectItems = Enum.GetValues(typeof(T))
                .Cast<T>()
                .Select(x => new SelectItemData(Convert.ToInt16(x).ToString(), x.ToString())).ToList();

            return selectItems;
        }
    }

}
